//
//  Message.swift
//  Drop
//
//  Created by zhuxuhong on 2018/3/19.
//  Copyright © 2018年 zhuxuhong. All rights reserved.
//

import UIKit

extension Message{
    enum Kind: Int {
        case dropLiked = 0 //喜欢墨滴
        case commentLiked = 1 //喜欢评论
        case dropCommented = 2 //评论墨滴
        case commentReplied = 3 //回复评论
        
        var tips: String{
            switch self {
            case .dropLiked:
                return "喜欢了你的墨滴"
            case .commentLiked:
                return "赞了你的评论"
            case .dropCommented:
                return "评论了你的墨滴:"
            case .commentReplied:
                return "回复了你的评论:"
            }
        }
        
        var icon: UIImage?{
            switch self {
            case .dropCommented, .commentReplied:
                return UIImage.named("toolbar_comment_fill")
            case .commentLiked:
                return UIImage.named("appreciate_fill")
            case .dropLiked:
                return UIImage.named("toolbar_heart_solid")
            }
        }
    }
}

class Message: NSObject {
	var id = 0
	var date: Date!
	var from = User()
	var to = User()
	var content = ""
	var kind = Kind.dropLiked
	var dropId = 0
	
	lazy var attributedTips: NSAttributedString = {
		let attr0 = NSAttributedString(string: "\(self.from.name) ")
		let attr1 = NSAttributedString(string: self.kind.tips, color: .gray)
		return NSMutableAttributedString(attrStrings: [attr0, attr1])
	}()
}
